<template>
    <p>child</p>
    <!-- <div>{{ name }}</div>
    <div>{{ arr }}</div> -->

    <button @click="send">click</button>
</template>

<script setup lang='ts'>
import { ref } from 'vue';

const emit = defineEmits(['on-click'])

const send = () => {
    // emit参数是名称，第二个参数回调函数的参数
    emit('on-click', 'emit')
}







const data = defineProps<{
    name: string,
    arr: number[]
}>(

)
// withDefaults为ts特有
withDefaults(defineProps<{
    name: string,
    arr: number[]
}>(), {
    arr: () => {
        666
    }
}
)

</script>
<style scoped></style>